# 转换Excel为清单
import os
import pandas as pd

# 报关资料所在文件夹（需要修改）
file_path = "/Users/wangzhiwei/Desktop/敬业-放行情况.xlsx"
min_row = 11
max_row = 160
sheet_name = "散货-放行情况"

def get_excel_info(file_path):
    df = pd.read_excel(file_path, sheet_name=sheet_name)
    for col in range(len(df.columns)):
        for i in range(len(df)):
            value = df.iloc[i, col]
            if type(value) == str and "放行" == value and i > (min_row - 1) and i < (max_row - 1):
                print("JY25066" + num_to_str(df.iloc[i-1, col]))
            elif type(value) == str and "自理放行" == value and i > (min_row - 1) and i < (max_row - 1):
                print("JY25066" + num_to_str(df.iloc[i-1, col]))
def num_to_str(num):
    if num < 10:
        return f'00{num}'
    elif num < 100:
        return f'0{num}'
    else:
        return f'{num}'
get_excel_info(file_path)